%%%-------------------------------------------------------------------
%%% @author admin
%%% @copyright (C) 2022, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 27. 五月 2022 20:22
%%%-------------------------------------------------------------------
-module(system_mHandler).
-author("admin").

-include("log.hrl").
-include("system_pb.hrl").
-include("account.hrl").

%% API
-export([
    handle_msg/2
]).

handle_msg(#c2s_login{qq_id = QQid}, State = #users{}) ->
    ?INFO("~w login",[QQid]),
    {ok, AccPid} = pl_svr:start(QQid, self()),
    {reply, ok, State#users{account_pid = AccPid}};

handle_msg(#c2s_create_player{name = Name}, State = #users{}) ->
    {ok, AccPid} = pl_svr:start(QQid, self()),
    {reply, ok, State#users{account_pid = AccPid}};

handle_msg(_Msg, State) ->
    ?WARNING("undefined msg:~p", [_Msg]),
    {reply, ok, State}.